# Contributor: Dmitry Romanenko <dmitry@romanenko.in>
# Maintainer: Dmitry Romanenko <dmitry@romanenko.in>
pkgname=py3-pytest-forked
_pyname=pytest-forked
pkgver=1.4.0
pkgrel=0
pkgdesc="extracted --boxed from pytest-xdist to ensure backward compat"
url="https://github.com/pytest-dev/pytest-forked"
arch="noarch"
license="MIT"
depends="py3-pytest"
makedepends="py3-setuptools py3-pbr"
checkdepends="py3-tox"
source="https://files.pythonhosted.org/packages/source/p/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver

replaces="pytest-forked" # Backwards compatibility
provides="pytest-forked=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare

	sed -e "s/use_scm_version=True/version='$pkgver'/" \
		-e '/setuptools_scm/d' \
		-i setup.py
}

build() {
	python3 setup.py build
}

check() {
	local _py3ver=$(python3 -c 'import sys; print("{}{}".format(sys.version_info.major, sys.version_info.minor))')
	tox -e py$_py3ver
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
ba402aec6dbec7a94815913192a49390b637a123d3557f48d809ae2e871e9e0cff8f9d0feb99e2bd06fe9486520b5e539f397d39475a720f8283b1bd21c751c7  pytest-forked-1.4.0.tar.gz
"
